package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.CommissionRate;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

public interface CommissionRateMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(CommissionRate record);

    int insertSelective(CommissionRate record);

    CommissionRate selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(CommissionRate record);

    int updateByPrimaryKey(CommissionRate record);

    //根据类型获得比例
    Map<String,Object> getCommissionRateByType(Integer type);

    //修改提成比例
    @Update("update c_commission_rate set commission_rate=#{rate}, update_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where id=#{id}")
    int updateCommissionRateById(@Param("id") Integer id, @Param("rate") Integer rate);
}